technovangelist / scripts / vs - enable wsl on gcp

vs - enable wsl on gcp

You need to test a product that runs on WSL, but you don’t have a Windows machine? That’s my situation and in case future me has the same problem, I will watch this video to figure out what I did. There are a number of problems to solve. I needed a Windows machine with an Nvidia GPU. And I need it to be able to run the WSL VM. GCP easily solved the first problem, but at first it seems that it doesn’t solve the second. In fact you look around online and it seems GCP just doesn’t support a VM inside a VM.

For this video, I am going to assume you are adept at GCP, but not necessarily Windows.

The secret to getting this working is a command line parameter when starting the instance. So you have to use the gcloud CLI. But you don’t really need to know much. You can start in the web console. Go to create a new VM Instance and design what you want. I needed GPU and chose an n1-standard-16. Set it to Windows with 120GB disk. Now click the show equivalent code button. You can either copy this command into your command line on your machine if you have the gcloud cli installed, or you can use the cloud shell. At the end of this super long line you need to add --enable-nested-virtualization. Now we can login and get WSL going.

Once the machine is up and you are logged in, open the